<template>
  <div class="tab">
    <el-table :data="orderListData" border style="width: 100%">
      <el-table-column align="center" fixed  label="序号" type="index" width="60"></el-table-column>
      <el-table-column align="center" prop="date" label="订单号" width="150"></el-table-column>
      <el-table-column align="center" prop="name" label="订单名" width="150"></el-table-column>
      <el-table-column align="center" prop="province" label="城市" width="120"></el-table-column>
      <el-table-column align="center" prop="city" label="订单状态" width="120"></el-table-column>
      <el-table-column align="center" prop="address" label="订单进度" width="120"></el-table-column>
      <el-table-column align="center" prop="zip" label="房源数量（套）" width="150"></el-table-column>
      <el-table-column align="center" prop="zip" label="异常房源（套）" width="150"></el-table-column>
      <el-table-column align="center" prop="zip" label="产权公司" width="180"></el-table-column>
      <el-table-column align="center" prop="zip" label="结佣规则" width="120"></el-table-column>
      <el-table-column align="center" prop="zip" label="创建时间" width="150"></el-table-column>
      <el-table-column align="center" prop="zip" label="创建人" width="150"></el-table-column>
      <el-table-column align="center" fixed="right" label="设置" width="180">
        <template slot-scope="scope">
          <el-button @click="handleCompany(scope.row)" type="text" size="small" :disabled="companyId ? true:false">产权公司</el-button>
          <el-button @click="handleAssistant(scope.row)" type="text" size="small">项目助理</el-button>
        </template>
      </el-table-column>
      <el-table-column align="center" fixed="right" label="操作" width="150">
        <template slot-scope="scope">
          <el-button @click="handleCheck(scope.row)" type="text" size="small">查看</el-button>
          <el-button @click="handleEdit(scope.row)" type="text" size="small">编辑</el-button>
          <el-button @click="handleDel(scope.row)" type="text" size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      :title="diaTitle"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose">
      <el-form>
        <el-form-item :label="diaName">
          <el-select v-model="companyId" :placeholder="diaPlaceholder" size="small" filterable clearable>
            <el-option :label="item.name" :value="item.namId" v-for="(item,index) in companyList" :key="index"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleCancle">取 消</el-button>
        <el-button type="primary" @click="handleConfirm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name:'tab',
  data(){
    return{
      dialogVisible:false,
      companyList: [
        {
          name:'nihao',
          namId:'6'
        }
      ],
      diaTitle:'',
      diaName:'',
      diaPlaceholder:'',
      companyId:'',
    }
  },
  props:['orderListData'],
  created(){
    // this.orderList()
  },
  // watch:{
  //   status:function(newVal,oldVal){
  //     if(newVal != oldVal){
  //       this.orderList()
  //     }
  //   }
  // },
  methods:{
    // 订单列表
    // orderList(){
    //   console.log(this.status)
    //   if(this.status == 1){
    //     console.log('全部')
    //   }else if(this.status == 2){
    //     console.log('待分配')
    //   }else if(this.status == 3){
    //     console.log('办理中')
    //   }else if(this.status == 4){
    //     console.log('已完成')
    //   }
    // },
    // 产权公司
    handleCompany(row) {
      this.diaTitle = '服务商设置'
      this.diaName = '产权公司：'
      this.diaPlaceholder = '搜索选择产权公司'
      this.dialogVisible = true
    },
    // 项目助理
    handleAssistant(row) {
      this.diaTitle = '项目助理设置'
      this.diaName = '服务商：'
      this.diaPlaceholder = '搜索选择项目助理'
      this.dialogVisible = true
    },
    // 查看
    handleCheck(row) {
      console.log(row);
      this.$router.push('/orderCheck')
    },
    // 编辑
    handleEdit(row) {
      console.log(row);
    },
    // 删除
    handleDel(row) {
      console.log(row);
    },
    handleCancle(){
      this.dialogVisible = false
    },
    handleConfirm(){
      console.log(this.companyId)
      this.dialogVisible = false
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
        })
        .catch(_ => {});
    }
  }
}
</script>

 <style lang="stylus" scoped>
  .tab{

  }
</style>